//
//  ListDetail.swift
//  one
//
//  Created by huangfeng on 2018/5/3.
//  Copyright © 2018年 huangfeng. All rights reserved.
//

import UIKit

class ListDetail: UITableViewController {
    
    @IBOutlet weak var nametext: UITextField!
    @IBOutlet weak var phonetext: UITextField!
    @IBOutlet weak var titletext: UITextField!
    var person: AddressPerson?
    
    var completionCallBack: (()->())?
    
    override func viewDidLoad() {
        super.viewDidLoad()

        if person != nil {
            nametext.text = person?.name
            phonetext.text = person?.phone
            titletext.text = person?.title
        }else{
            person = AddressPerson()
        }

    }

    @IBAction func person_Save(_ sender: UIBarButtonItem) {
        
        person?.name = nametext.text
        person?.phone = phonetext.text
        person?.title = titletext.text
        
        completionCallBack?()
        navigationController?.popViewController(animated: true)
        
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}
